package org.example.spring.self.demo.tl.c02.applicationlistener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class MainClass {

	private static final long serialVersionUID = 1;

	public static void main(String[] args) {
		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MainConfig.class);

		for (int i = 0; i < 10; i++) {
			ctx.publishEvent(new ApplicationEvent("手动发布事件") {
				private static final long serialVersionUID = 2;

				@Override
				public Object getSource() {
					return super.getSource();
				}
			});

		}
		ctx.close();
	}
}
